package progeny;

public class HalfChromosome {
	final Gene[] genes;
	
	public HalfChromosome(Gene[] genes){
		this.genes = genes;
	}
	
	public Allele[] merge(HalfChromosome other){
		Allele[] a = new Allele[genes.length];
		for (int i = 0; i < genes.length; i++)
			a[i] = new Allele(this.genes[i], other.genes[i]);
		return a;
	}
	
	public Allele[] merger(Gene[] other){
		return merge(new HalfChromosome(other));
	}
	
	public boolean canMerge(HalfChromosome other){
		return this.genes.length == other.genes.length;
	}
	
	public String toString(){
		String result = "";
		for (Gene g: genes)result+=g.toString().toUpperCase()+",";
		return result;
	}
}
